package org.hitchhike.core.service;

import java.util.List;

import org.hitchhike.core.domain.Provinces;
import org.hitchhike.core.repository.ProvincesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
@CacheConfig(cacheNames = "provinces")
public class ProvincesService {

  @Autowired
  private ProvincesRepository provincesRepository;

  public List<Provinces> findAll() {
    return provincesRepository.findAll();
  }

  @Cacheable
  public Provinces findByProvinceid(String provinceid) {
    return provincesRepository.findByProvinceid(provinceid);
  }

}
